package com.szl.sbssh.core;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.QueryByExampleExecutor;

import java.io.Serializable;
import java.util.List;
import java.util.Optional;

/**
 * Author: songzhonglin
 * Date: 2018/4/17
 * Time: 9:43
 * Description:
 **/
@NoRepositoryBean
public interface JpaRepository <T, ID extends Serializable> extends PagingAndSortingRepository<T, ID>, QueryByExampleExecutor<T> {

    Page<T> findAll(Specification<T> spec, Pageable pageable);

    T findOne(Specification<T> spec);

    List<T> findAll(Specification<T> spec);

    List<T> findAll(Specification<T> spec, Sort sort);

    long count(Specification<T> spec);

}
